import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/api/warehouses/1/orders',
    method: 'get',
    params: query
  })
}

export function process(oid, data) {
  return request({
    url: '/api/orders/' + oid,
    method: 'post',
    data
  })
}

export function pickingOrder(list) {
  return request({
    url: '/api/picking-orders',
    method: 'post',
    data:{
      order_id: list
    }
  })
}

export function getOrderById(id) {
  return request({
    url: '/api/warehouses/1/orders/' + id,
    method: 'get'
  })
}

export function getOrderItemsById(id) {
  return request({
    url: '/api/orders/' + id + '/items/print',
    method: 'get'
  })
}

export function printOrder(id,picking_order_id) {
  let url ='/api/util/print/orders/' + id
  if(picking_order_id && '' != picking_order_id){
    url = url + '?picking_order_id=' + picking_order_id
  }
  return request({
    url: url,
    method: 'get'
  })
}

export function editRemark(id, data) {
  return request({
    url: '/api/orders/' + id + '/remark',
    method: 'post',
    data
  })
}

